/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bs.Beans;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Bone
 */
@Entity
@Table(name = "empresa_transporte_itinerario")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "EmpresaTransporteItinerario.findAll", query = "SELECT e FROM EmpresaTransporteItinerario e")})
public class EmpresaTransporteItinerario implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(nullable = false)
    private Integer id;
    @Column(length = 100)
    private String nome;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(precision = 18, scale = 6)
    private BigDecimal tarifa;
    @Lob
    @Column(length = 65535)
    private String trajeto;
    @JoinColumn(name = "ID_EMPRESA_TRANSPORTE", referencedColumnName = "ID", nullable = false)
    @ManyToOne(optional = false)
    private EmpresaTransporte idEmpresaTransporte;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idEmpresaTranspItin")
    private List<FolhaValeTransporte> folhaValeTransporteList;

    public EmpresaTransporteItinerario() {
    }

    public EmpresaTransporteItinerario(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public BigDecimal getTarifa() {
        return tarifa;
    }

    public void setTarifa(BigDecimal tarifa) {
        this.tarifa = tarifa;
    }

    public String getTrajeto() {
        return trajeto;
    }

    public void setTrajeto(String trajeto) {
        this.trajeto = trajeto;
    }

    public EmpresaTransporte getIdEmpresaTransporte() {
        return idEmpresaTransporte;
    }

    public void setIdEmpresaTransporte(EmpresaTransporte idEmpresaTransporte) {
        this.idEmpresaTransporte = idEmpresaTransporte;
    }

    @XmlTransient
    public List<FolhaValeTransporte> getFolhaValeTransporteList() {
        return folhaValeTransporteList;
    }

    public void setFolhaValeTransporteList(List<FolhaValeTransporte> folhaValeTransporteList) {
        this.folhaValeTransporteList = folhaValeTransporteList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EmpresaTransporteItinerario)) {
            return false;
        }
        EmpresaTransporteItinerario other = (EmpresaTransporteItinerario) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bs.Beans.EmpresaTransporteItinerario[ id=" + id + " ]";
    }
    
}
